<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>水平居中</title>

    <style>
        .header {
            width: 200px;
            height: 200px;
            margin: 0 auto;
            background-color: #333;
            text-align: center;
            color: cornsilk;
        }
    </style>
</head>

<body>
    <div class="header">
        <span>aaaaaa</span>
        <span>aaaaaa</span>
    </div>

</body>

</html>